package org.lee.springsecurity.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @author jackielee
 * @version 1.0
 * @description WebSecurityConfig
 * @date 2021/3/30
 **/
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.httpBasic() // HTTP Basic认证方式 默认是form认证
                .and()
                .authorizeRequests() // 授权配置
                .anyRequest() // 所有请求
                .authenticated(); // 都需要认证
    }
}
